Protobuf: The three key words required, optional, or repeated

您所在的位置:网站首页 vue protobuf Protobuf: The three key words required, optional, or repeated

Protobuf: The three key words required, optional, or repeated

#Protobuf: The three key words required, optional, or repeated| 来源: 网络整理| 查看: 265

The required keyword

As the name implies, it means that both the sender and receiver of the data must handle this field, otherwise how can they communicate

Optional keyword

When protobuf handles this field, it adds a bool variable to mark whether the optional field has a value. When the sender sends the field, it marks the bool variable as true if the field has a value. Otherwise it is marked false, and the receiver will receive the bool variable sent by the sender at the same time as the field. This will tell the field whether or not it has a value. This is what option means.

This is what they call a smooth upgrade, which means nothing more than compatibility.

It's the same way you give an array address and an array number when you pass an argument.

Repeated keyword

The sender sends the count count and the field's initial address as an optional optional value. The sender sends the count count and the field's initial address as an optional value. After receiving the data, the receiver parses the corresponding data according to COUNT.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3